package jwdt.xadmin.bbs.action;

import jwdt.common.action.BaseAction;
import jwdt.xadmin.bbs.bean.TBconfig;

import com.ezerg.db.Jdb;
import com.ezerg.web.Form;
import com.ezerg.web.Module;
import com.ezerg.web.Page;
import com.ezerg.web.annotation.Controller;
import com.ezerg.web.annotation.RequestMapping;

@Controller("/xadmin/bbs")
public class ConfigManageAction extends BaseAction {

	protected String url = "/xadmin/bbs/";
	
	@RequestMapping("/ltjbpzManage")
	public Page doLtjbpz(Form f, Module m) throws Exception {
		f.add("obj", Jdb.get().get(TBconfig.class, 1));
		//
		return m.findPage(url.concat("ltjbpzManage"));
	}

	@RequestMapping("/ltjbpzact")
	public Page doLtjbpzact(Form f, Module m) throws Exception {
		String ret = "保存成功！";
		TBconfig obj = (TBconfig)Jdb.get().get(TBconfig.class, 1);
		obj = (TBconfig)f.copy2Obj(obj);
		try {
			Jdb.get().update(obj);
		} catch (Exception e) {
			ret = "保存失败！";
			e.printStackTrace();
		}
		//
		return m.writePage(ret);
	}

	@RequestMapping("/ltjcpzManage")
	public Page doLtjcpz(Form f, Module m) throws Exception {
		f.add("obj", Jdb.get().get(TBconfig.class, 1));
		//
		return m.findPage(url.concat("ltjcpzManage"));
	}

	@RequestMapping("/ltjcpzact")
	public Page doLtjcpzact(Form f, Module m) throws Exception {
		String ret = "保存成功！";
		TBconfig obj = (TBconfig)Jdb.get().get(TBconfig.class, 1);
		obj = (TBconfig)f.copy2Obj(obj);
		try {
			Jdb.get().update(obj);
		} catch (Exception e) {
			ret = "保存失败！";
			e.printStackTrace();
		}
		//
		return m.writePage(ret);
	}



}